package com.tymoshenko.seabattle;

import com.tymoshenko.seabattle.shared.model.domain.Board;
import com.tymoshenko.seabattle.shared.model.domain.Point;
import com.tymoshenko.seabattle.shared.model.domain.Ship;
import org.junit.Test;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Stack;

import static org.junit.Assert.assertEquals;

/**
 * @author Yakiv Tymoshenko
 * @since 08.02.13
 */
public class Playground {

    @Test
    public void addSeveralNullsToList() {
        List<Point> list = new ArrayList<Point>();
        list.add(Point.valueOf(1000, 1000));
        list.add(Point.valueOf(1011, 1111));
        for (Point point : list) {
            System.out.println(point);
        }
        assertEquals(2, list.size());   // proved to allow multiple nulls
    }

    @Test
    public void enumMapOrder() {
        for (Map.Entry<Ship.Type, Integer> rule : Ship.getPlacementRules().entrySet()) {
            System.out.println(rule); // 4-3-2-1 Order depends upon enum.ordinal. So if we define 4-deck as 1st el of enum, it will be first in for-each
        }
    }

    @Test
    public void stackTest() {
        Stack<Board.Status> stack = new Stack<Board.Status>();
        stack.push(Board.Status.MISSED);
        stack.push(Board.Status.FREE);
        stack.push(Board.Status.DECK);
        for (int i = 0; i < 3; i++) {
            System.out.println(stack.peek());
        }

    }
}
